package cn.buk.tms.entity.misc;

import com.fasterxml.jackson.annotation.JsonFormat;

import jakarta.persistence.*;
import java.util.Date;

/**
 * 企业客户：用户账单/订单的 签注
 * @author yfdai
 */
@Entity
@Table(name="customer_note",	uniqueConstraints=@UniqueConstraint(name="uk_customer_note",	columnNames={"enterprise_id", "customer_id", "note_type", "name"} ))
public class CustomerNote {

    /**
     * 成本中心
     */
    public static final int COST_CENTER = 100;

    /**
     * 项目名称
     */
    public static final int PROJECT_NAME = 200;

    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private int id;

    @Column(name="enterprise_id", updatable = false)
    private int enterpriseId;

    @ManyToOne
    @JoinColumn(name = "customer_id", foreignKey = @ForeignKey(name = "fk_note_customer"))
    private Customer customer;

    /**
     * 备注类型
     */
    @Column(name = "note_type")
    private int noteType = COST_CENTER;

    @Column(length=50, nullable = false)
    private String name;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time", insertable = false, updatable = false)
    private Date createTime;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getEnterpriseId() {
        return enterpriseId;
    }

    public void setEnterpriseId(int enterpriseId) {
        this.enterpriseId = enterpriseId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public int getNoteType() {
        return noteType;
    }

    public void setNoteType(int noteType) {
        this.noteType = noteType;
    }
}
